//16进制转换为10进制
#include <iostream>
using namespace std;
typedef long long ll;

ll calc(char i)
{
	if(i >= 'A') return 10+i-'A';
	else return i - '0';
}
int main()
{
	ll ans = 0;
	ll k = 16;
	string s = "2021ABCD";
	for(int i = 0; i < s.size(); i++)
	{
		ans = ans * k + calc(s[i]); 
	}
	cout << ans;
	return 0;
}
